<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .odiv1{
            width: 100px;
            height: 100px;
            background-color: red;
        }
        .odiv2{
            width: 200px;
            height: 200px;
            background-color: yellow;
        }
    </style>
</head>
<body>
    <div id="outer"></div>
    <button id="b1">显示</button>
    <button id ="b2">隐藏</button>
</body>
<script>
    // var aobj = document.createElement('a')
    // var div_obj = document.getElementById('outer')
    // div_obj.appendChild(aobj)

    var b1 = document.getElementById('b1')
    b1.onclick = function () {
        var div_obj = document.getElementById('outer')
        div_obj.setAttribute('class','odiv')
    }
    var b2 = document.getElementById('b2')
    b2.onclick = function () {
        var div_obj = document.getElementById('outer')
        div_obj.removeAttribute('class')
    }
</script>
</html>